
#ifndef COMMON_H_H
#define	COMMON_H_H

#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "sys_com.h"
#include "dataproc.h"
#include "pulse.h"
#include "str_ext.h"
#include "mytype.h"

#ifdef	__cplusplus
extern "C" {
#endif

#define GD25_DBG_EN		0
#define MB_DBG_EN		0
#define OS_API_DBG_EN	0
#define KEY_DBG_EN		0
#define FLASH_DBG_EN	0
#define FILE_DBG_EN		0
#define MALLOC_DBG_EN	0
	
#ifdef DEBUG
#define DBG_EN           1
#else
#define DBG_EN           0
#endif


#if DBG_EN > 0
#define dbg_print			sys_printf
#define dbg_puts			sys_puts
#define dbg_u8_print		mem_u8_disp
#define dbg_u16_print		mem_u16_disp
#define dbg_u32_print		mem_u32_disp
#else
#define dbg_print(...)
#define dbg_puts(...)
#define dbg_u8_print(...)
#define dbg_u16_print(...)
#define dbg_u32_print(...)
#endif

#if (DBG_EN+GD25_DBG_EN) > 1
#define gd25_dbg_print          sys_printf
#define gd25_dbg_puts           sys_puts
#else
#define gd25_dbg_print(...)
#define gd25_dbg_puts(...)
#endif

#if (DBG_EN+MB_DBG_EN) > 1
#define mb_dbg_print          sys_printf
#define mb_dbg_puts           sys_puts
#else
#define mb_dbg_print(...)
#define mb_dbg_puts(...)
#endif
	
#if (DBG_EN+OS_API_DBG_EN) > 1
#define api_dbg_print          sys_printf
#define api_dbg_puts           sys_puts
#else
#define api_dbg_print(...)
#define api_dbg_puts(...)
#endif
	
#if (DBG_EN+KEY_DBG_EN) > 1
#define key_dbg_print          sys_printf
#define key_dbg_puts           sys_puts
#else
#define key_dbg_print(...)
#define key_dbg_puts(...)
#endif
	
#if (DBG_EN+FLASH_DBG_EN) > 1
#define flash_dbg_print          sys_printf
#define flash_dbg_puts           sys_puts
#else
#define flash_dbg_print(...)
#define flash_dbg_puts(...)
#endif	
	
#if (DBG_EN+FILE_DBG_EN) > 1
#define file_dbg_print          sys_printf
#define file_dbg_puts           sys_puts
#else
#define file_dbg_print(...)
#define file_dbg_puts(...)
#endif
	
#if (DBG_EN+MALLOC_DBG_EN) > 1
#define malloc_dbg_print          sys_printf
#define malloc_dbg_puts           sys_puts
#else
#define malloc_dbg_print(...)
#define malloc_dbg_puts(...)
#endif
	
void mem_u8_disp(const void * head, const void * dat, int len, int line);
void mem_u16_disp(const void * head, const void * dat, int len, int line);
void mem_u32_disp(const void * head, const void * dat, int len, int line);

#ifdef	__cplusplus
}
#endif

#endif	/* COMMON_H_H */
